package com.haorui.lygyd.config;

import com.haorui.fileserver.FileSaveUtils;
import com.haorui.lygyd.authority.filter.RequestAuthorityFilter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author 陈刚
 * @version 1.0
 * @project ZNSM
 * @package com.haorui.main.config
 * @createDate 2017-12-30 4:07
 * @modfiyDate
 * @function 自定义拦截器配置
 */
//@Configuration
public class WebMvcIntercepterConfig  extends WebMvcConfigurerAdapter {

//    @Autowired
    RequestAuthorityFilter requestAuthorityFilter;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        String acountPhotoPatter="/"+ FileSaveUtils.accountPhotoPath+"/**";
        String memberPhotoPatter="/"+ FileSaveUtils.memberPhotoPath+"/**";
        registry.addInterceptor(requestAuthorityFilter).addPathPatterns("/**").excludePathPatterns(acountPhotoPatter,memberPhotoPatter,null);
        super.addInterceptors(registry);
    }
}
